'use strict'

const Controller = require('egg').Controller

class RoleController extends Controller {
  async getRoleList() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.role.getRoleList(ctx.query)
    ctx.body = resBody
  }
  async getSingleRole() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.role.getSingleRole({
      id: ctx.params.id,
    })
    ctx.body = resBody
  }
  async createRole() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.role.createRole(
      ctx.request.body
    )
    ctx.body = resBody
  }
  async updateRole() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.role.updateRole(
      ctx.request.body,
      ctx.params.id
    )
    ctx.body = resBody
  }
  async deleteRole() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.role.deleteRole(
      ctx.params.id
    )
    ctx.body = resBody
  }
}

module.exports = RoleController
